package com.mmz.springmvc.helloworld;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

/**
 * 控制器
 * @author Administrator
 *
 */
public class HelloAction implements Controller{
	public HelloAction(){
		System.out.println("HelloAction()");
	}

	@Override
	public ModelAndView handleRequest(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.addObject("msg", "Hello Springmvc");
		//这个写的是真是路径
		modelAndView.setViewName("/jsp/success.jsp");
		//这个写的是逻辑路径(springmvc.xml文件中需要配置视图器)
		modelAndView.setViewName("success");
		return modelAndView;
	}
	
}
